﻿using Basic.FormRemoteModel.Form;
using Basic.FormRemoteModel.Form.Model;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.Helper;

namespace Basic.FlowExtendService.lmpl
{
    [ClassLifetimeAttr(ClassLifetimeType.SingleInstance)]
    internal class FormService : IFormService
    {

        public Dictionary<long, string> GetName ( long[] ids )
        {
            if ( ids.IsNull() )
            {
                return null;
            }
            return new GetFormNames
            {
                Ids = ids
            }.Send();
        }

        public void LockForm ( long? sourId, long? formId, long appId )
        {
            if ( sourId.HasValue || formId.HasValue )
            {
                new LockPhyForm
                {
                    Param = new LockFormArg
                    {
                        FormId = formId,
                        LinkPk = appId,
                        LinkType = "FlowApp",
                        LooseFormId = sourId
                    }
                }.Send();
            }
        }
    }
}
